// import com.alibaba.druid.sql.ast.statement.SQLExprTableSource;
// import com.alibaba.druid.sql.dialect.mysql.visitor.MySqlASTVisitor;

// import java.util.ArrayList;
// import java.util.List;

#include "MySqlCheckTableStatement.h"
#include "../../../../ast/statement/SQLExprTableSource.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "../../../../../utils/listTran.h"

MySqlCheckTableStatement::MySqlCheckTableStatement()
{
  tables = std::make_shared<std::list<SQLExprTableSource_ptr>>();
}

void MySqlCheckTableStatement::addTable(SQLExprTableSource_ptr table)
{
  if (table == nullptr)
  {
    return;
  }

  table->setParent(SharedObject(MySqlCheckTableStatement));
  tables->push_back(table);
}

SQLExprTableSource_list_ptr MySqlCheckTableStatement::getTables()
{
  return tables;
}

void MySqlCheckTableStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlCheckTableStatement)))
  {
    SQLObject_list_ptr tmp = ListTran::tran_class<SQLExprTableSource, SQLObject>(tables);
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlCheckTableStatement));
}
